﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="BuildingTaxes.aspx.cs" Inherits="Taxes.Caculate.BuildingTaxes" %>

<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <script src="../Scripts/swfupload/swfupload.js" type="text/javascript"></script>
    <script type="text/javascript" src="../Scripts/swfupload/swfuploadevent.js"></script>
    <script type="text/javascript" src="../Scripts/swfupload/InitSwfUpload.js"></script>
    <script type="text/javascript" src="../Scripts/swfupload/Simple.js"></script>
    <script type="text/javascript" src="../Scripts/JSTrim.js"></script>
    <script type="text/javascript">
        function Up() {
            for (var i = 0; i < storeFiles.getCount(); i++) {
                Ext.net.DirectMethods.Up(storeFiles.getAt(i).get('FilePath'));
            }
        }
    </script>
</head>
<body>
    <ext:ResourceManager ID="ResourceManager1" runat="server">
        <Listeners>
            <%--此处调用的方法按照SWFUpload官方的示例实在window.onload事件中处理，为了适应Ext.NET，不得不这么做，你懂得--%>
            <DocumentReady Single="true" Handler="return InitSwf('xls');" />
        </Listeners>
    </ext:ResourceManager>
    <div>
        <ext:Store ID="storeFiles" runat="server" ShowWarningOnFailure="false">
            <Reader>
                <ext:JsonReader IDProperty="ID">
                    <Fields>
                        <ext:RecordField Name="ID" />
                        <ext:RecordField Name="MailId" />
                        <ext:RecordField Name="FilePath" />
                        <ext:RecordField Name="FileName" />
                        <ext:RecordField Name="FileSize" Type="Int" />
                        <ext:RecordField Name="FileExtension" />
                        <ext:RecordField Name="FileCreationDate" Type="Date" />
                        <ext:RecordField Name="FileModificationDate" Type="Date" />
                        <ext:RecordField Name="FileCreator" />
                        <ext:RecordField Name="FileId" />
                        <ext:RecordField Name="FileIndex" />
                    </Fields>
                </ext:JsonReader>
            </Reader>
            <Listeners>
                <%--移除记录时引发storeFilesRemoveEvent事件--%>
                <Remove Fn="storeFilesRemoveEvent2" />
                <%--添加记录时引发storeFilesAddEvent事件--%>
                <Add Fn="storeFilesAddEvent" />
            </Listeners>
        </ext:Store>
        <ext:GridPanel runat="server" ID="gpFiles" StoreID="storeFiles" Title="导入文件" Frame="true"
            Layout="FormLayout" StripeRows="true" AutoExpandColumn="FileName" Width="600"
            Height="270" AnchorHorizontal="100%">
            <ColumnModel>
                <Columns>
                    <ext:Column ColumnID="FileName" DataIndex="FileName" Header="名称">
                    </ext:Column>
                    <ext:Column ColumnID="FilePath" DataIndex="FilePath" Header="FilePath" Hidden="true">
                    </ext:Column>
                    <ext:Column ColumnID="FileSize" DataIndex="FileSize" Header="大小">
                        <Renderer Fn="renderSize" />
                    </ext:Column>
                    <ext:Column ColumnID="FileExtension" DataIndex="FileExtension" Header="类型">
                    </ext:Column>
                    <ext:Column ColumnID="FileCreationDate" DataIndex="FileCreationDate" Header="创建日期"
                        Hidden="true">
                    </ext:Column>
                    <ext:Column ColumnID="FileModificationDate" DataIndex="FileModificationDate" Header="FileModificationDate"
                        Hidden="true">
                    </ext:Column>
                    <ext:Column ColumnID="FileCreator" DataIndex="FileCreator" Header="FileCreator" Hidden="true">
                    </ext:Column>
                    <ext:CommandColumn Width="24" Resizable="false">
                        <Commands>
                            <%--每行后面添加一个删除按钮，用来删除已上传的文件--%>
                            <ext:GridCommand Icon="Delete" CommandName="delete" ToolTip-Text="删除">
                                <ToolTip Text="删除"></ToolTip>
                            </ext:GridCommand>
                        </Commands>
                    </ext:CommandColumn>
                </Columns>
            </ColumnModel>
            <SelectionModel>
                <ext:RowSelectionModel ID="ctl16" />
            </SelectionModel>
            <Listeners>
                <%--点击每行后面的删除按钮时引发gpFlilesDelete--%>
                <Command Fn="gpFlilesDelete" />
            </Listeners>
            <Buttons>
                <%--swfupload库通过这个按钮ID来找到并替换此区域,此ID比较关键，后面的样式是为了做一些美观处理，可去掉看看效果--%>
                <ext:Button runat="server" ID="btnUploadFile" StyleSpec="visibility:hidden;height:25;width:75">
                </ext:Button>
                <ext:Button runat="server" ID="btnCancelFileUpload" Text="取消" Hidden="true">
                    <Listeners>
                        <Click Fn="CancelFileUpload" />
                    </Listeners>
                </ext:Button>
            </Buttons>
            <BottomBar>
                <ext:StatusBar ID="StatusBar1" runat="server">
                    <Content>
                        <ext:ProgressBar ID="pbar" runat="server" Hidden="true">
                        </ext:ProgressBar>
                    </Content>
                </ext:StatusBar>
            </BottomBar>
            <Buttons>
            </Buttons>
        </ext:GridPanel>
        <ext:Button ID="Button1" runat="server" Text="确定">
            <Listeners>
                <Click Fn="Up" />
            </Listeners>
        </ext:Button>
    </div>
</body>
</html>
